package com.mxx.common.core;


import java.io.Serializable;
import java.util.Map;
import java.util.Objects;

public class Entry<K, V> implements Map.Entry<K, V> {


    private K key;


    private V value;


    public K getKey() {
        return key;
    }


    @Override
    public V getValue() {
        return value;
    }

    @Override
    public V setValue(V value) {
        return this.value = value;
    }


    public Entry(K key, V value) {
        this.key = key;
        this.value = value;
    }


    @Override
    public String toString() {
        return key + "=" + value;
    }


    @Override
    public int hashCode() {
        return key.hashCode() * 13;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o instanceof Entry) {
            Entry pair = (Entry) o;
            if (!Objects.equals(key, pair.key)) return false;
            return true;
        }
        return false;
    }
}

